<?php
declare (strict_types=1);

namespace app\admin\service\system;

use app\model\system\SystemAdmin;
use app\model\system\SystemGroup;

class AminService
{
    /**
     * 获取系统用户
     * @param array $where
     * @return \think\Paginator
     * @throws \Exception
     * @author dgc<453342213@qq.com>
     */
    public function getList($where = [])
    {
        $list = (new SystemAdmin())->getPageSize([]);
        if (empty($list)) {
            throw  new \Exception('请联系管理员，还未设置权限', -1);
        }
        return $list;
    }

    /**
     * 操作
     * @param array $where
     * @return \think\Collection
     * @throws \Exception
     * @author dgc<453342213@qq.com>
     */
    public function saves($param = [], $id)
    {
        $where = [];
        if ($id > 0) {
            $where['id'] = $id;
        }
        $model=new SystemAdmin();
        $info = $model->where($where)->save($param);
        return $model;
    }
}
